package me.xiaoyan.java.chapter14.customer;

public class CustomerBizTest {

	CustomerBiz[] custs = new CustomerBiz[30];
	
	/**
	 * 将客户
	 * @param customer
	 */
	public void addCustomer(CustomerBiz customer){
		for (int i = 0; i < custs.length; i++) {
			if(custs[i] == null){//判断数组该位置是否赋值
				custs[i] = customer;//如果没有赋值，就可以赋值
				break;
			}
		}
	}
	
	public void showCustomer(){
		for (int i = 0; i < custs.length; i++) {
			if(custs[i] != null){
				custs[i].showInfo();
			}
		}
	}
	
	public static void main(String[] args) {
		//创建test对象
		CustomerBizTest test = new CustomerBizTest(); 
		
		//创建zhengtao
		CustomerBiz zhengtao = new CustomerBiz();
		zhengtao.name = "郑涛";
		zhengtao.age = 18;
		zhengtao.hasCard = true;
		
		test.addCustomer(zhengtao);
		
		CustomerBiz wujial = new CustomerBiz();
		wujial.name = "wujialiang";
		wujial.age = 3;
		wujial.hasCard = false;
		test.addCustomer(wujial);//添加wujial
		
		test.showCustomer();
	}
	
}
